﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

public partial class XSSJ_JCQL : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!Page.IsPostBack)
    {
      if (!ProjectPrivate.GetQX("13"))
      {
        Server.Transfer("~\\blank.aspx");
      }
      //DataSet ds = CBSJ.GetYear();
      //CommonUse.BindDDL(ds, "year", "year", DateTime.Now.Year.ToString(), ddlYear);
      //if (CWSD.GetSDZT())
      //{
      //  Server.Transfer("~\\sd.aspx");
      //}
    }
    BindGrid();
  }

  protected void BindGrid()
  {
    DataSet ds = DbHelperSQL.Query(@"select  ROW_NUMBER() OVER (ORDER BY a.khid desc) AS XH,a.*,c.KHMC,c.KH 
from sjlr_cbsj_jzql a,sjlr_cbsj_jznf b,jcxx_khxx c
where a.nf=b.nf and a.khid=c.khid");
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }

  protected void cpPopup_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
  {
    //litText.Text = CBSJ.GetNotes(e.Parameter).ToString();
    string[] sl = e.Parameter.Split(new char[] { ',' });
    khidHF.Value = sl[0];
    nfHF.Value = sl[1];
    string sql = "select * from sjlr_cbsj_jzql where nf=" + sl[1] + " and khid=" + sl[0];
    SqlDataReader dr = DbHelperSQL.ExecuteReader(sql);
    if (dr.Read())
    {
      litText.Text = dr["tzql"].ToString();
    }
    dr.Close();
  }
  protected void Button1_Click(object sender, EventArgs e)
  {
    string sql = "update sjlr_cbsj_jzql set tzql=" + litText.Text + "  where khid=" + khidHF.Value + " and nf=" + nfHF.Value;
    DbHelperSQL.ExecuteSql(sql);
    BindGrid();
  }
}